/**
*	流程模块： 部门管理dept的扩展js
*	开发者：雨中磐石
*	地址：www.rockoa.com
*	日期：2023-07-20
*/

js.dept_input = function(){
	

	this.onsubmitbefore = function(d){
		if(d.cid=='0')return '请先选择对应单位';
	}
	
}



js.dept_list = function(){
	
	var me = this;
	var pidss = '0';

	this.initbodys = function(){
		if(this.iscompany){
			this.optobj.showleft('组织结构');
			this.settable({
				sort:'sort',dir:'asc',
				urlparams:{pid:'0'}
			});
			this.setcolumns('cid',{
				hidden:true
			});
		}else{
			this.optobj.addhide();
		}
	}
	
	this.onloadbefore = function(d){
		if(d.deptarr){
			importjs('tree','create', {
				data:d.deptarr,
				view:this.optobj.leftcontid(),
				openchliren:true,
				onitemclick:function(d){
					me.openpid(d.id);
				}
			});
		}
	}
	
	this.openpid = function(pid){
		pidss = pid;
		this.table.setparams({pid:pid}, true);
	}
	
	this.onaddbefore = function(){
		return {
			data:{'pid':pidss}
		};
	}
}